#pragma once

#include "General Structures.hpp"
#include "ClippingPlane.h"
#include "Vector2D.h"

class SelectionBox
{
private:
	// the corrected versions are used to ease rendering / management, the original versions are used to update the selection box
	Vector2D m_CorrectedStart,
			 m_CorrectedEnd,
			 m_OriginalStart,
			 m_OriginalEnd;
	
	// This function takes the original vectors and "generates" the corrected vectors
	void GenerateCorrectedVectors();

	OGL_Color m_Color;	// color of selection box
	
	

public:
	// Ctr
	SelectionBox();

	// Simply renders the selection box
	void Render(ClippingPlane *pClipPlane);
	
	// Set functions
	inline void SetStart(Vector2D start)	{m_OriginalStart = start; GenerateCorrectedVectors();}
	inline void SetEnd(Vector2D end)		{m_OriginalEnd = end; GenerateCorrectedVectors();}
	inline void SetColor(OGL_Color col)		{m_Color = col;}

	// Get functions
	inline Vector2D GetCorrectedStart()	{return m_CorrectedStart;}
	inline Vector2D GetCorrectedEnd()	{return m_CorrectedEnd;}

	// Returns if the position is in the selection box's bounds
	bool InBounds(const Vector2D& position);
	bool OutOfBounds(const Vector2D& position);

};